package org.seven.jrdp.commons.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Result implements Serializable {
	private static final long serialVersionUID = 1L;
	public static final Result SUCCESS = new Result();
	public static final Result FAILURE = new Result(false, "操作失败");

	private boolean success = true;
	private String msg = "操作成功";
	private Map<String, Object> info = new HashMap<String, Object>();

	public Result() {
	}

	public Result(String msg) {
		this.msg = msg;
	}

	public Result(boolean success, String msg) {
		this.success = success;
		this.msg = msg;
	}

	public boolean isSuccess() {
		return success;
	}

	public Result setSuccess(boolean success) {
		this.success = success;
		return this;
	}

	public String getMsg() {
		return msg;
	}

	public Result setMsg(String msg) {
		this.msg = msg;
		return this;
	}

	public Result put(String key, Object value) {
		info.put(key, value);
		return this;
	}

	public Result putAll(Map<String, Object> map) {
		info.putAll(map);
		return this;
	}

	public Map<String, Object> getInfo() {
		return info;
	}
}